/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Merlion.MRP.entity;

import Merlion.SCM.entity.InventoryBatchEntity;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;

@Entity
public class ProductionLineEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date mfgDate;
    
    @OneToMany
    private Collection<InventoryBatchEntity> productBatches;
    private double remainingNormalShift; //in hours
    private double remainingOvertimeShift; //in hours
    private double changeOverTime; //in hours
    private Long lastProductInLine;
    private int lineNumber;

    public ProductionLineEntity() {
    }

    public ProductionLineEntity(Date mfgDate , int lineNumber) {
        this.mfgDate = mfgDate;
        this.remainingNormalShift = 8;
        this.remainingOvertimeShift = 4;
        this.changeOverTime = 0.5;
        this.lineNumber = lineNumber;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
      
    public Date getMfgDate() {
        return mfgDate;
    }

    public void setMfgDate(Date mfgDate) {
        this.mfgDate = mfgDate;
    }

    public Collection<InventoryBatchEntity> getProductBatches() {
        return productBatches;
    }

    public void setProductBatches(Collection<InventoryBatchEntity> productBatches) {
        this.productBatches = productBatches;
    }

    public double getChangeOverTime() {
        return changeOverTime;
    }

    public void setChangeOverTime(double changeOverTime) {
        this.changeOverTime = changeOverTime;
    }

    public int getLineNumber() {
        return lineNumber;
    }

    public void setLineNumber(int lineNumber) {
        this.lineNumber = lineNumber;
    }

    public double getRemainingNormalShift() {
        return remainingNormalShift;
    }

    public void setRemainingNormalShift(double remainingNormalShift) {
        this.remainingNormalShift = remainingNormalShift;
    }

    public Long getLastProductInLine() {
        return lastProductInLine;
    }

    public void setLastProductInLine(Long lastProductInLine) {
        this.lastProductInLine = lastProductInLine;
    }

    public double getRemainingOvertimeShift() {
        return remainingOvertimeShift;
    }

    public void setRemainingOvertimeShift(double remainingOvertimeShift) {
        this.remainingOvertimeShift = remainingOvertimeShift;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ProductionLineEntity other = (ProductionLineEntity) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if (this.mfgDate != other.mfgDate && (this.mfgDate == null || !this.mfgDate.equals(other.mfgDate))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 29 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 29 * hash + (this.mfgDate != null ? this.mfgDate.hashCode() : 0);
        return hash;
    }


}
